package cc.mrbird.febs.system.domain;

import cc.mrbird.febs.common.converter.TimeConverter;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wuwenze.poi.annotation.ExcelField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 *
 *
 * @author dtwei
 */
@Data
@TableName("t_area")
@Accessors(chain = true)
public class Area implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 区域ID
     */
    @TableId(value = "AREA_ID", type = IdType.AUTO)
    private Long areaId;

    /**
     * 上级区域ID
     */
    @TableField("PARENT_ID")
    private Long parentId;

    /**
     * 区域名称
     */
    @NotBlank(message = "{required}")
    @Size(max = 20, message = "{noMoreThan}")
    @ExcelField(value = "名称")
    @TableField("AREA_NAME")
    private String areaName;

    /**
     * 区域层级
     */
    @TableField("LEVEL_NUM")
    @ExcelField(value = "区域层级")
    private Integer levelNum;

    @TableField("ORDER_NUM")
    private Double orderNum;

    /**
     * 创建时间
     */
    @TableField("CREATE_TIME")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ExcelField(value = "创建时间", writeConverter = TimeConverter.class)
    private Date createTime;

    /**
     * 修改时间
     */
    @TableField("MODIFY_TIME")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ExcelField(value = "修改时间", writeConverter = TimeConverter.class)
    private Date modifyTime;

    @TableField("CREATE_USERNAME")
    private String createUsername;

    @TableField("CREATE_USER_ID")
    private Long createUserId;

    @TableField("MODIFY_USERNAME")
    private String modifyUsername;

    @TableField("MODIFY_USER_ID")
    private Long modifyUserId;

    private transient List<TResident> residents;

    private transient String createTimeFrom;
    private transient String createTimeTo;

}
